#include <pic.h>
#include "sad8.h"
#include <stdlib.h>
#include <stdio.h>
#include "globalset.h"

extern volatile bank1 byte chanel_therm[cnChanel_Therm_Len] ;
extern 		unsigned int	therm_temp ;
extern	bank1	byte	chanel_no;
extern	bit 	bTherm_check ; 
extern	const	 cnDuanXian1[];





void therm_check (void )
{
#ifdef 	_THERM_CHECK
		volatile static bit onlinebit;
		volatile static  unsigned int therm_pretemp;

			bTherm_check = 0 ;

		onlinebit = (chanel_therm[17] & cnDuanXian1[chanel_no] )?1:0;

				if ( ! onlinebit ) 
				{
						*((byte *)(&therm_pretemp))       =  chanel_therm [chanel_no*2+1] ;
						*(((byte *)&(therm_pretemp)) +1 ) =  chanel_therm[chanel_no*2];

						if ( abs ( therm_temp - therm_pretemp )>40 )
								bTherm_check = 1;
				}
#endif
	
}

